﻿/*
* edirauth - http://edirauth.codeplex.com
* A .NET library and utility for authenticating to eDirectory
* Copyright (c) 2013 Matt Shirilla (http://shirilla.com)
* Licensed under the Microsoft Public License (MS-RL)
* http://edirauth.codeplex.com/license
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using Novell.Directory.Ldap;
using System.Reflection;
using edirAuth;

namespace edirAuthConsole
{
    class EdirAuthConsole
    {
        
        static void Main(string[] args)
        {
            EdirAuthorizer edirAuthorizer = new EdirAuthorizer(
                                 ConfigurationManager.AppSettings["ldapServer"],
                                 Convert.ToInt16(ConfigurationManager.AppSettings["ldapPort"]),
                                 ConfigurationManager.AppSettings["bindUser"],
                                 ConfigurationManager.AppSettings["bindPass"],
                                 ConfigurationManager.AppSettings["searchBase"],
                                 ConfigurationManager.AppSettings["lookupAttrName"]
                                 );

            AuthInfo authInfo = edirAuthorizer.authenticate(args[0], args[1]);
            Console.WriteLine(header);
            Console.WriteLine();
            Console.WriteLine(authInfo.ToConsoleString());
            Console.WriteLine(">>>hit enter to quit<<<");
            string l = Console.ReadLine();
        }

        static string header = "* edirauth - http://edirauth.codeplex.com                     *\r\n" +
                               "* A .NET library and utility for authenticating to eDirectory *\r\n" +
                               "* Copyright (c) 2013 Matt Shirilla (http://shirilla.com)      *\r\n" +
                               "* Licensed under the Microsoft Public License (MS-RL)         *\r\n" +
                               "* http://edirauth.codeplex.com/license                        *\r\n";




    }//class
}//namespace
